package com.godGuang.system.controller;

/**
 * @Author The future is full of hope
 * @CreateTime 2024/1/16 0016 9:36
 * @PackageName:com.godGuang.system.controller
 * @ClassName: SendEmailController
 */

import com.alibaba.fastjson.JSONObject;
import com.godGuang.common.core.domain.Result;
import com.godGuang.system.service.SendEmailService;
import com.godGuang.system.service.SysConfigService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 邮件发送
 */

@RestController
@RequestMapping("/config")
@Log4j2
public class SendEmailController {

    @Autowired
    private SendEmailService sendEmailService;
    @Autowired
    private HttpServletRequest request;


    /**
     * 发送验证码
     */
    @PostMapping("/sendResetPwdMail")
    public Result sendResetPwdMail(@RequestParam String email) {
        log.info("功能名称：获取验证码，请求URI：{}，请求方式：{}，请求参数：{}",
                request.getRequestURL(), request.getMethod(), email);
        Result result = sendEmailService.sendResetPwdMail(email);
        log.info("功能名称：获取验证码，请求URI：{}，请求方式：{}，请求参数：{}",
                request.getRequestURL(), request.getMethod(), JSONObject.toJSONString(result));
        return result;
    }
}
